home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9768 < prev    next >
Encoding:
Text File  |  1996-08-05  |  989 b   |  38 lines

  1. Newsgroups: comp.lang.c
  2. Path: netcom.com!sergeboj
  3. From: sergeboj@netcom.com (Serge Bojoulitch)
  4. Subject: Re: HELP! Modifying the EOF in a file!
  5. Message-ID: <sergebojDo7264.824@netcom.com>
  6. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  7. X-Newsreader: TIN [version 1.2 PL1]
  8. References: <4i585k$4ia@news.netam.net> <4i5pb4$fae@sparcserver.lrz-muenchen.de>
  9. Date: Wed, 13 Mar 1996 07:01:16 GMT
  10. Sender: sergeboj@netcom15.netcom.com
  11.  
  12. ua302aa@lrz-muenchen.de wrote:
  13. : >Why doesn't the EOF character chop off the remaining two lines?
  14.  
  15. : Since a file can be seen as a sequence of char, and since EOF is
  16. : _not_ a char, who knows. 
  17.  
  18. : Kurt
  19.  
  20. For the simple reason that in most implementations EOF is defined
  21. as -1 to indicate error status.  When you use
  22.  
  23.     fprintf(dat,"Hello! %c",EOF);
  24.  
  25. it is the same as
  26.  
  27.     fprintf(dat,"Hello! %c",oxff);
  28.  
  29. or, possibly,
  30.  
  31.     fprintf(dat,"Hello! %c",oxffff);
  32.  
  33. The EOF character for ASCII files is ASCII 4 (in old UNIX).
  34.  
  35. Regards,
  36.  
  37. Serge Bojoulitch
  38.